from qiniu import Auth,put_data

access_key = 'v3n5FPnRvLujRroKe3X9FxjMSgtWCmMWBeharusu'
secret_key = 'd3uJUlaQ9iKh0b5XkhU-Tlx5hjrDiWDDeHA4xotw'

#要上传的空间
bucket_name = 'ihome'

def storage(data):
    q = Auth(access_key, secret_key)
    token = q.upload_token(bucket_name)
    ret ,info = put_data(token,None,data)
    if info.status_code == 200:
        return ret.get("key")
    else:
        return  ""

if __name__ == '__main__':
    file = input('请输入文件名')
    with open(file,'rb')as f:
        storage(f.read())